//
//  KAHomeInfo.swift
//  kano
//
//  Created by Frank on 2024/9/11.
//

import KakaJSON

struct KAAuditState: Convertible, Codable {
    var bizStatus: Int = 0
    var userType: Int = 0
    var currentTime: Int = 0
    //auditState 是否已授信: 1或true，已授信
    var auditState: Int = 0

    var refuseCode: String = ""
    var list: String = ""
    var isLargeSubCredit: String = ""
    var isNormalCredit: String = ""
    var largeSubCheckCreditTime: String = ""
    var lastCreditTime: String = ""
    var canLoan: String = ""
    var businessType: String = ""
    var creditElement: String = ""
}


struct KAHomeInfo: Convertible {
    var hasSetPassword: Bool = false
    //firstAuthFlag: 1、用户首次授信成功(AF上报用)
    var firstAuthFlag: Int = 0
    //firstGetQuotaFlag: 1、第一次获取配额标志(AF上报用)
    var firstGetQuotaFlag: Int = 0
    //loanBillList 贷款账单列表
    var loanBillList: [KALoanBillList]? 
    var productInfosList: [KAProductInfo]?
    var isHuidus: Bool = false
    var registerTime: Int = 0
    var bizStatus: Int = 0
    // isSubLogic 1:大额
    var isSubLogic: Int = 0
    var smsReportGray: Int = 0
    var bindDeviceFlag: Int = 0
    var updateEmergencyContactList: Bool = false
    var isGrayscale: Bool = false
    var isDevDataValid: Bool = false
    //borrowingLoanType: 0:无在借订单  1:短贷  2:大额分期（蝌蚪贷属于小额，这里不影响）
    var borrowingLoanType: Int = 0
    var userInviteGray: Bool = false
    var ifWithdraw: Bool = false
}

// MARK: - ProductInfo
struct KAProductInfo: Convertible, Codable {
    //productType 产品类型：1、14天小额 2、大额
    var productType: Int = 0
    //creditLine 授信额度: 0:未授信，其他可借款
    var creditLine: Double = 0.00
    //可借金额
    var canBorrowAmount: Double = 0.00
    var rate: Double = 0.00
    var productInfoList: [KAProductDetail]?
}

// MARK: - ProductInfoDetail
struct KAProductDetail: Convertible, Codable {
    var minLoanAmount: Double = 0.00
    var productId: Int = 0
    var productName: String = ""
    var productPeriod: String = ""
    var periodNumber: Int = 0
    var multiple: Int = 0
    var maxLoanAmount: Int = 0
}


struct KALoanBillList: Convertible {
    var recordLoanGid: String = ""
    var guaranteeCardGid: String = ""
    var withdrawCardGid: String = ""
    var loanLeftAmount: Int = 0
    var loanAmount: Int = 0
    var overdueFee: Int = 0
    var repaymentStatus: Int = 0
    var dueTime: TimeInterval = 0
    var isOverdue: Bool = false
    var canRenew: Bool = false
    var refundingStatus: Int = 0
    var loanType: Int = 0
    //exceedDays 过期几天
    var exceedDays: Int = 0
    var uploadCertificateState: Int = 0
    var periodIndex: Int = 0
    var periodNumber: Int = 0
    var orderNo: String = ""
    var applyReduceOverDueFeeTime: Int = 0
    var repaymentAmount: Int = 0
    var renewExpiredTime: Int = 0
}





//MARK: - Banner
struct KAHomeBanner: Convertible, Codable {
    var totalUserNumber: Int = 0
    var topImageList: [KAHomeBannerImg]?
    var functionList: [KAHomeBannerFunc]?
}

struct KAHomeBannerImg: Convertible, Codable {
    //title
    var title: String = ""
    //img
    var imageUrl: String = ""
    //target
    var targetUrl: String = ""
    var id: Int = 0
    var createTime: TimeInterval = 0
    var updateTime: TimeInterval = 0
    var displayStartTime: TimeInterval = 0
    var displayEndTime: TimeInterval = 0
    var displaySequence: Int = 0
    var positionIndex: Int = 0
    var description: String = ""
    var canClickStatus: Int = 0
    var reqChannel: Int = 0
    var bizStatus: Int = 0
    var bizType: String = ""
}
struct KAHomeBannerFunc: Convertible, Codable {

}



//MARK: - News

struct KAHomeNewsContent: Convertible, Codable {
    var dialogType: Int = 0
    var id: Int = 0
    var createTime: TimeInterval = 0
    var updateTime: TimeInterval = 0
    var noticeType: Int = 0
    var userType: Int = 0
    var reqChannel: String = ""
    var titleDisplay: String = ""
    var title: String = ""
    var content: String = ""
    var buttonType: Int = 0
    //2:中度公告 在公告使用期间，不管打开多少次该页面，每天只弹出一次该公告; 3:弱公告 只弹一次; 其他：强公告  首次进入app弹出
    var strongWeakType: Int = 0
    var imgUrl: String = ""
    //"/index":首页  "/lendInfo":借款  "/risk":授信  "/bill":账单  "/invitefriends_new":邀请好友
    var extendUrl: String = ""
    var isValid: Bool = false
    var validStartTime: TimeInterval = 0
    var validEndTime: TimeInterval = 0
    var description: String = ""
    var targetAuth: Int = 0
    var channelType: String = ""
    var bizType: String = ""
    var importFileUrl: String = ""
    var importRelationId: String = ""
}
struct KAHomeNews: Convertible, Codable {
    //公告类型
    var newsType: Int = 0
    //公告集合
    var noticeContent: [KAHomeNewsContent]?
    //营销公告
    var marketActivities: [KAHomeNewsContent]?
    var homePageGuide: String = ""
    var statePageGuide: String = ""
    var pageStyleGuide: String = ""
    var voucherValue: String = ""
    var tadpoleLoanReduceAmount: String = ""
    var shareActive: Bool = false
}

//MARK: - 优惠券
struct KAHomeCoupon: Convertible, Codable {

    var id: Int = 0
    var gid: String = ""
    var popup: Bool = false

    var userInviteRelationId: String = ""
    var voucherValue: Double = 0.00
    
    var prizeType: Int = 0
    var expireTime: TimeInterval = 0
    var type: Int = 0
    var conditionUpperLimit: Int = 0
    var conditionLowerLimit: Int = 0
    //0,单期券 1 分期券 4 通用券
    var voucherTransType: Int = 0
    var maximumLimitNum: Int = 0
}
